# -*- makefile -*-

LIBUTL/     :=$(realpath $/../libutil/)/
LIBSEQ/     :=$(realpath $/../libseq/)/

src    := $/alphabet.c \
          $/alphabet.h \
          $/alphabet-acgtspace.c \
          $/alphabet-colorspace.c \
          $/bio++.H \
          $/bio.h \
          $/halign.c \
          $/kmer.C \
          $/kmer.H \
          $/kmerhuge.H \
          $/kmeriface.H \
          $/kmertiny.H \
          $/merCovering.H \
          $/merList.H \
          $/mers.h \
          $/reversecomplement.c

old :=    $/fasta-accessor.H \
          $/fasta-c.C \
          $/fasta-c.h \
          $/fasta-cache.C \
          $/fasta-cache.H \
          $/fasta-simple.c \
          $/fasta-simple.h \
          $/fasta.C \
          $/fasta.H \
          $/merstream.C \
          $/merstream.H \
          $/seq.C \
          $/seq.H \
          $/seqFactory.H \
          $/seqFile.H \
          $/seqInCore.H \
          $/seqOnDisk.H \
          $/seqStore.H \
          $/seqStream.H \
          $/sff.H \
          $/sff.C


$/.C_SRCS    :=$(filter %.c,${src})
$/.C_INCS    :=$(filter %.h,${src})
$/.CXX_SRCS  :=$(filter %.C,${src})
$/.CXX_INCS  :=$(filter %.H,${src})
$/.CXX_LIBS  :=$/libbio.a

$/.CLEAN := $/*.o

$(eval $/%.d $/%.o: CFLAGS   += -I${LIBUTL/})
$(eval $/%.d $/%.o: CXXFLAGS += -I${LIBUTL/})

$/reversecomplement.c.d: $/alphabet.h
$/merstream.C.d:         $/alphabet.h

$/libbio.a: ${$/.C_SRCS:.c=.o} ${$/.CXX_SRCS:.C=.o} $/alphabet.o

$/alphabet.c: $/alphabet.h
$/alphabet.h: $/alphabet-generate.c $/alphabet-acgtspace.c $/alphabet-colorspace.c
	$(CC) $(CFLAGS) $(CFLAGS_COMPILE) -o `dirname $@`/a.out $<
	cd `dirname $@` ; ./a.out && rm -f ./a.out
